package AccountWindow.SystemAdmin;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class SystemAdminWindowHandler implements ActionListener {

    private SystemAdminWindow systemAdminWindow;

    public SystemAdminWindowHandler(SystemAdminWindow systemAdminWindow){this.systemAdminWindow = systemAdminWindow;}

    @Override
    public void actionPerformed(ActionEvent e) {
        String actionCommand = e.getActionCommand();
        System.out.println("actiondCommand="+actionCommand);

        try{
            if("roomDetail".equals(actionCommand)){
                systemAdminWindow.cardLayout.show(systemAdminWindow.systemAdminPanel,"roomDetailPanel");
            } else if ("accountDetail".equals(actionCommand)) {
                systemAdminWindow.cardLayout.show(systemAdminWindow.systemAdminPanel,"accountDetailPanel");
                systemAdminWindow.accountDetailWindow.refreshAccountDetailPanel();
            }else if ("newRegister".equals(actionCommand)) {
                systemAdminWindow.cardLayout.show(systemAdminWindow.systemAdminPanel,"newRegisterPanel");
                systemAdminWindow.newRegisterWindow.refreshNewRegisterPanel();
            } else if ("personalDetail".equals(actionCommand)) {
                systemAdminWindow.cardLayout.show(systemAdminWindow.systemAdminPanel,"personalDetailPanel");
            }
        }catch (Exception error){
            error.printStackTrace();
        }


    }

}
